window.phoenix&&(window.phoenix.buildInfo||(window.phoenix.buildInfo=[]),-1===window.phoenix.buildInfo.findIndex((e=>"Phoenix-upper-funnel"===e.MFE))&&window.phoenix.buildInfo.push({MFE:"Phoenix-upper-funnel",VERSION:"release-phoenix-upper-funnel-1.1.34939.1371721126-39f68b2d-4-g4c3fc7698",LASTCOMMITDATETIME:"2024-07-16T18:00:25-06:00"})) /*! * * ============= BUILD INFO ============= * MFE: Phoenix-upper-funnel * chunkName: component-clientlibs/productFilter.v1/productFilter * VERSION: release-phoenix-upper-funnel-1.1.34939.1371721126-39f68b2d-4-g4c3fc7698 * BRANCH: release/fix-upper-funnel0717 * COMMITHASH: 4c3fc7698bddb05cca402d984d9c7e93c1830225 * LASTCOMMITDATETIME: 2024-07-16T18:00:25-06:00 * ============= If you're reading this, why not come work with us? https://www.t-mobile.com/careers ============= */,function(){"use strict";var e,t,r={5650:function(e,t,r){r.d(t,{l:function(){return i}});const i={">=sm":"(min-width: 480px)",">=md":"(min-width: 600px)",">=lg":"(min-width: 1024px)",">=xl":"(min-width: 1280px)","{const t=e.pathname;if(t.match(/\/cellphone\/|\/cellphones\/|\/cell-phones\/|\/cell-phone\/|\/cell-phones$/gi))return"CELLPHONES";if(t.match(/\/tablet\/|\/tablets\/|\/tablets$/gi))return"TABLETS";if(t.match(/\/smart-watch\/|\/smartwatches\/|\/smart-watches\/|\/smart-watches$/gi))return"SMARTWATCHES";if(t.match(/\/hotspot-iot-connected-device\/|\/hotspots-iot-connected-devices\/|\/hotspot-iot-connected-devices\/|\/hotspots-iot-connected-devices$|\/hotspots_iot_connected_devices$/gi))return"HOTSPOTS_IOT_CONNECTED_DEVICES";return t.match(/\/accessory\/|\/accessories\/|\/accessories$/gi)?"ACCESSORIES":null}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var o=i[e]={exports:{}};return r[e](o,o.exports,s),o.exports}s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e=s(5650),t=s(4886),window.Alpine?.data("productFilter",(r=>({topic:void 0,selectedDevices:[],categoryName:"",isMobile:!1,mobileFiltersEnabled:!1,wrapperEl:void 0,resultCount:0,filterSelectedCount:0,init(){this.topic=r,this.wrapperEl=this.$el?.querySelector("[data-upf-product-filters-wrapper]"),this.events();const i=(0,t.f1)(new URL(window.location.href));i&&(this.categoryName=i),window.phoenix.experience.utils?.registerMediaQuerySensor?.({max:e.l["this.isMobile=e})},markFiltersOnInit(){const e=new URL(window.location.href),t=Array.from(new Set(e.searchParams.keys()));for(const r of t){const t=e.searchParams.getAll(r);for(const e of t){const t=/[a-zA-Z0-9-+]/gi;if(!e.match(t))continue;const r=e.replaceAll(" ","+").toLowerCase(),i=this.wrapperEl?.querySelector(`[data-upf-filter-displayName='${r}']`);if(i&&!i.checked){i.checked=!0,i.dispatchEvent(new Event("change"));const e=i.closest("[data-upf-product-filter-group]"),t=e?.querySelector("[data-upf-product-filter-show-more-cta]");i.parentElement?.classList.contains("tdds:hide")&&t&&this.toggleFilters(t)}}}const r=e.pathname.split("/"),i=r[r.length-1].toLowerCase();if(i&&i.length>1){const e=i.includes("t-mobile")?i:i.replaceAll("-","+").replaceAll("t+mobile","t-mobile"),t=decodeURI(e),r=this.wrapperEl?.querySelectorAll(`[data-upf-filter-displayName='${t}']`);if(r&&r.length>=1)for(let e=0;e=1)return a.searchParams.append(i,l),a.searchParams.sort(),void history.pushState({},"",a.toString());const r=a.searchParams.getAll(i).find((e=>e.toLowerCase()===l)),n=this.wrapperEl?.querySelectorAll("input:checked[id^='filter-'"),c=n?.length??0,h=a.href.split("/"),d=h[h.length-2].toLowerCase().replaceAll(/-+/g," ").toLowerCase(),p=this.wrapperEl?.querySelector(`[data-upf-filter-facetSingular='${d}']`);if("radio"===t.type){if(0===e&&1===c&&d===o&&p)return a.href=h.splice(0,h.length-1).join("/"),a.href+=`/${l.replaceAll(" ","-")}`,void history.pushState({},"",a.toString());a.searchParams.delete(i)}if(!r&&c>1&&p){n?.forEach((e=>{const t=e.getAttribute("data-upf-filter-facetSingular")?.toLowerCase().replaceAll("+"," "),r=e.getAttribute("data-upf-filter-displayName")?.toLowerCase().replaceAll("+"," ");t&&r&&a.searchParams.append(t,r)}));const e=Array.from(a.searchParams.entries());e.sort(((e,t)=>e[0]===t[0]?e[1].localeCompare(t[1]):e[0].localeCompare(t[0])));const t=a.pathname.split("/");return a.pathname=t.splice(0,t.length-2).join("/"),a.search=new URLSearchParams(e).toString(),void history.pushState({},"",a.toString())}if(!r&&e>=1){a.searchParams.append(i,l),a.searchParams.sort();const e=Array.from(a.searchParams.entries());e.sort(((e,t)=>e[0]===t[0]?e[1].localeCompare(t[1]):e[0].localeCompare(t[0])));const t=new URL(window.location.href);return t.search=new URLSearchParams(e).toString(),void history.pushState({},"",t.toString())}return r||0!==e||p?void 0:(a.href=`${a.href}/${i.replaceAll(/\s+/g,"-")}/${l.replaceAll(/\s+/g,"-")}`,window.phoenix.bus.publish("PRODUCT_FILTER","FILTER_HEADER",{payload:s}),void history.pushState({},"",a.toString()))}let n=a.searchParams.toString().split("&");if(a.searchParams.has(i)){const e=new URLSearchParams;if(a.searchParams.forEach(((t,r)=>{r.toLowerCase()===i&&t.toLowerCase()!=l&&e.append(r.toLowerCase(),t.toLowerCase())})),a.searchParams.delete(i),e.forEach(((e,t)=>{a.searchParams.append(t,e)})),a.searchParams.sort(),n=a.searchParams.toString().split("&"),1===n.length){const e=Array.from(a.searchParams.keys())[0],t=Array.from(a.searchParams.entries()).flat().join("/").replaceAll(/\s+/g,"-").toLowerCase(),r=this.wrapperEl?.querySelector(`[data-upf-filter-facetSingular='${e}']:checked`);r&&(window.phoenix.bus.publish("PRODUCT_FILTER","FILTER_HEADER",{payload:r.value}),a.searchParams.delete(e),a.href=`${a.href}/${t}`)}history.pushState({},"",a.toString())}else(0===n.length||""===n[0]&&1===n.length)&&this.clearQueryString(a)},clearQueryString(e){const t=new URLSearchParams;e.search=t.toString();let r=new URL(e.href);const i=e.href.split("/"),s=i[i.length-2].toLowerCase().replaceAll(/-+/g," "),o=this.wrapperEl?.querySelector(`[data-upf-filter-facetSingular='${s}']`);o&&(r=new URL(i.splice(0,i.length-2).join("/"))),history.pushState({},"",r.toString())},events(){window.phoenix.bus.subscribe("PRODUCT_CATEGORIES","FETCH_FAMILY_CATEGORY_SUCCESS",this.renderText.bind(this)),"FILTER"===this.topic?.toUpperCase()&&window.phoenix.bus?.subscribe("AUTOCOMPLETE","OPTION_SELECTED",this.filterByDevice.bind(this)),window.phoenix.bus?.subscribe("PRODUCT_GRID","RESULT_COUNT",this.setResultCount.bind(this)),window.phoenix.bus?.subscribe("PRODUCT_GRID","SHOW_FILTERS",this.toggleMobileFiltersOverlay.bind(this)),document.addEventListener("alpine:initialized",(()=>{this.markFiltersOnInit()}))},emitChange(e,t,r,i,s,o){this.updateQueryString(r,e,i,s??"",o??"");let l=e.value;s?.toLowerCase().includes("price")&&(l=e.value.replaceAll("$","").replaceAll(" ","").replace(/(\d+)\+(\D|$)/g,"$1-plus$2")),window.phoenix.bus.publish("PRODUCT_GRID",`${t||this.topic}_PRODUCTS`,{payload:{key:l,category:r,fieldName:l,categoryName:s,buttonType:e.type}}),e instanceof HTMLInputElement&&(e.checked?this.filterSelectedCount++:this.filterSelectedCount--,this.emitFilterSelectedCount())},emitFilterSelectedCount(){window.phoenix.bus?.publish("PRODUCT_FILTER","FILTER_COUNT",{payload:{count:this.filterSelectedCount}})},setAccessoryFilterTypeOnInit(e,t){document.getElementById(t).checked=!0,this.clearFilters(e)},clearFilters(e){const t=this.$el?.closest("[data-upf-product-filter]");(t?.querySelectorAll("[data-upf-product-filter-input]:checked")).forEach((t=>{e&&t.value===e?t.checked=!0:t.checked=!1,this.emitChange(t,"FILTER","CLEAR")})),this.removeDcFilter("all"),this.filterSelectedCount=0,this.emitFilterSelectedCount()},filterByDevice(e){this.selectedDevices.find((t=>t.value===e?.payload?.value))||(this.selectedDevices=[e?.payload,...this.selectedDevices],window.phoenix.bus?.publish("PRODUCT_FILTER","DEVICE_COMPATIBILITY",{payload:{value:this.selectedDevices}})),this.filterSelectedCount++,this.emitFilterSelectedCount()},getResultsFoundLabel(e,t){return 1===this.resultCount?`${this.resultCount} ${t}`:`${this.resultCount} ${e}`},removeDcFilter(e){"all"===e?this.selectedDevices=[]:(this.filterSelectedCount--,this.emitFilterSelectedCount(),this.selectedDevices=this.selectedDevices.filter((t=>t.value!==e))),window.phoenix.bus?.publish("PRODUCT_FILTER","DEVICE_COMPATIBILITY",{payload:{value:this.selectedDevices}})},renderText(e){this.categoryName=e?.payload?.categoryName},setResultCount(e){this.resultCount=e?.payload?.count},toggleFilters(e){const t=e.closest("[data-upf-product-filter-group]"),r=t?.querySelectorAll("[data-upf-product-filter-option]");r.forEach(((e,t)=>{t>3&&e.classList.toggle("tdds:hide")}));const i=t?.querySelector("[data-upf-product-filter-show-more-cta]"),s=t?.querySelector("[data-upf-product-filter-show-fewer-cta]");if(i?.classList.toggle("tdds:hide"),s?.classList.toggle("tdds:hide"),i?.classList.contains("tdds:hide")){const e=r[4].querySelector("label");e?.focus()}s.classList.contains("tdds:hide")&&i?.focus()},toggleMobileFiltersOverlay(){if("FILTER"===this.topic){this.mobileFiltersEnabled=!this.mobileFiltersEnabled;const e=document.querySelector("[data-upf-legal-text-section]");if(this.isMobile){if(this.mobileFiltersEnabled){e?.classList.add("tdds:hide"),window.scrollTo(0,0),window.bodyScrollLock.disableBodyScroll(this.wrapperEl);const t=document.getElementById("product-filter-close");t?.focus()}else{e?.classList.remove("tdds:hide"),window.bodyScrollLock.enableBodyScroll(this.wrapperEl);const t=document.getElementsByClassName("upf-productFilter__mobile-cta");if(t?.length>0){const e=t[0];e?.focus()}}document.documentElement.style.overflow=this.mobileFiltersEnabled?"hidden":"auto"}}}})))}();